/*
 *  ifxparams.hpp - Informix parameter classes for dbExpress
 *
 *    Copyright (c) 2001-2006, Luxena Software Company. All rights reserved.
 *
 *  Purpose:
 *
 */

#ifndef __IFXPARAMS_HPP__
#define __IFXPARAMS_HPP__

#ifndef __cplusplus
#error This header requires a C++ compiler ...
#endif

#include <ifxtypes.h>
#include <sqlda.h>
#include "dbxpress.hpp"
#include "ifxconnection.hpp"
#include "ifxvariable.hpp"


/////////////////////////////////////////////////////////////////////////////
// CInformixParameters

class CInformixParameters : public ifx_sqlda_t
{
public:
	CInformixParameters (int2 count);
	~CInformixParameters ();
    int2 getCount ();
	CInformixVariable& operator [] (int2 number);
private:
	CInformixVariable *_variables;
};


////////////////////////////////////////////////////////////////////////////
// CInformixParameterValueFactory

class CInformixParameterValueFactory
{
public:
	struct Args
	{
		STMTParamType paramType;
		DataType dataType;
		UINT32 length;
		pVOID buffer;
		CInformixConnection *connection;
	};

	static CInformixAbstractValue * createValue (const Args& args);

	static CInformixAbstractValue * handleUnsupported (const Args& args);
	static CInformixAbstractValue * createStringValue (const Args& args);
	static CInformixAbstractValue * createDateValue (const Args& args);
	static CInformixAbstractValue * createBlobValue (const Args& args);
	static CInformixAbstractValue * createBoolValue (const Args& args);
	static CInformixAbstractValue * createShortValue (const Args& args);
	static CInformixAbstractValue * createLongValue (const Args& args);
	static CInformixAbstractValue * createFloatValue (const Args& args);
	static CInformixAbstractValue * createBCDValue (const Args& args);
	static CInformixAbstractValue * createTimeValue (const Args& args);
	static CInformixAbstractValue * createTimeStampValue (const Args& args);
	static CInformixAbstractValue * createDateTimeValue (const Args& args);

private:
	typedef CInformixAbstractValue * (*ValueCreatorFunc) (const Args& args);
	static ValueCreatorFunc ValueCreatorTable[];
};

#endif // __IFXPARAMS_HPP__
